<%--
功能：获得广告
--%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ tag import="org.springframework.context.ApplicationContext" %>
<%@ tag import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ tag import="com.probiz.estore.content.service.AdvertisementManager" %>
<%@ tag import="com.probiz.estore.common.model.content.Advertisement" %>
<%@ tag import="com.probiz.estore.common.model.content.AdvertisementPublish" %>

<%@ attribute name="positionCode"  required="true" type="java.lang.String"%>
<%@ attribute name="categoryId"  required="false" type="java.lang.Integer"%>
<%
	ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext());
	AdvertisementManager advertisementManager = (AdvertisementManager) ctx.getBean("advertisementManager");
	AdvertisementPublish advertisementPublish = advertisementManager.getAdvertisementPublishForFront(positionCode,categoryId);
	if(null != advertisementPublish){
		request.setAttribute("advertisements",advertisementPublish.getAdvertisements());
		request.setAttribute("adPositionType",advertisementPublish.getAdPositionType());
	}else{
		request.setAttribute("advertisements",null);
		request.setAttribute("adPositionType",null);
	}
%>		
<jsp:doBody />

